<?PHP
if (!HasLogin()) {
	if(isset($_POST['dialog_submit']) && $_POST['dialog_submit']=="登录")
	{
		$email = trim(GetPostParamStr("username"));
		$psw = trim(GetPostParamStr("password"));
	
		$sql = "select * from tsj_user where email='$email' limit 1";
		$resultdl = mysql_query( $sql );
		if (mysql_num_rows($resultdl) > 0)
		{
			//
			$rowdl = mysql_fetch_assoc( $resultdl );
			if ($rowdl["password"] != "")
			{
				if (md5($psw) == $rowdl["password"])
				{
					$_SESSION["isoauth"] = 0;
					$_SESSION["email"] = $email;
					$_SESSION["userid"] = $rowdl["id"];
					$_SESSION["nickname"] = $rowdl["nick_name"];
					$_SESSION["right"] = $rowdl["right"];
				}
				else
				{
					echo "<script>alert('密码错误！');</script>";
				}
			}
			else
			{
				echo "<script>alert('您没有升级账号，不能分享！');</script>";
			}
		}
		else
		{
			echo "<script>alert('不存在的账号！');</script>";
		}
	}
	?>
	
	<script type="text/javascript">
	function check_user_logon(){
		var username = $("#username").val();
		var password = $("#password").val();
		if(username.length == 0){
			alert("请正确输入您的注册邮箱/昵称");
			return false;
		}
		 if (password.length == 0) {
			alert("请正确输入您的密码");
			return false;
		 }
		 
		return true;
	}
	function onClose()
	{
		$("#dialog").css("display","none");
		$("#modal_shadow").css("display","none");
	}
	</script>
	<div id="dialog" class="dialog" style="">
		<div class="wrapper">
			<div class="title"><span style="margin-left: 5px;">登录</span></div>
			<div class="content">
				<div style="" id="pop_login_content">
					<div style="display: block;" id="default" class="from_otherweb left">
						<div class="wel_tips">Hi~帅哥靓女！</div>
						<div class="wel_tips">快登录兔丝街，走在时尚的前沿！</div>
					</div>
					<div id="popLoginForm" class="left">
					<form method="post" onsubmit="return check_user_logon();" action="">
					<div style="margin: 0;" class="area">
						<span class="pword">账 号：</span>
						<input type="text" class="c_textbox" value="" id="username" name="username">
					</div>
					<div class="area">
						<span class="pword">密 码：</span>
						<input type="password" class="c_textbox" value="" id="password" name="password">
					</div>
					<div class="login mt10 left"><input type="submit" name="dialog_submit" class="login_btn f14 red cursor" value="登录"></div>
					</form>
				</div>
				<ul id="defaultright" class="pop_login_right left">
					<li><a href="http://www.tusijie.com/user/register.php" class="reg_btn applyrefer"></a></li>
					<li class="mt10">你也可以：</li>
					<li class="mt10"><a target="_blank" href="http://www.tusijie.com/public/weibosdk/oauth"><span class="login_style login_XL"></span>用新浪微博账号登录</a></li>
					<li class="mt10"><a target="_blank" href="http://www.tusijie.com/public/qqsdk/oauth/redirect_to_login.php"><span class="login_style login_Q"></span>用QQ账号登录</a></li>
				</ul>
			</div>
		</div>
		<div class="close" onclick="onClose()"></div>
	</div>
	</div>
	<div id="modal_shadow" style=""></div>
<?php } ?>